package matse11.project;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class HighscoreActivity extends Activity 
{
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.highscoreview); 
    	ListView lvHighscore = (ListView) findViewById(R.id.lvHighscore);
    	Button btBack = (Button) findViewById(R.id.btZurueck);
    	btBack.setOnClickListener(new zurueckClick(this));
    	
    	BufferedReader in;
    	ArrayList<String> highscoreListe = new ArrayList<String>();
    	
System.out.println(highscoreListe);
   	
    	try {
    		in=new BufferedReader(new FileReader("highscore.txt"));
    	    String line="";
    	    while ((line=in.readLine())!=null) {
    	    	line = in.readLine();
    	    	System.out.println(line+"                    asd");
    	    	highscoreListe.add(line);
    	    }
    	    in.close();
    	}
    	catch(FileNotFoundException e) {}
    	catch(IOException e) {}
    	
System.out.println(highscoreListe);
    	
    	ListAdapter listenAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, highscoreListe);
    	lvHighscore.setAdapter(listenAdapter);
    }
     
    
}
